package com.hzy.alibaba.dao.primary;

import com.hzy.alibaba.entity.primary.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface UserDao extends JpaRepository<User,Long> {

    User getUserByUserName(String userName);

    /**
     * 根据关注者id查找所有记录（查找关注的人的id）
     *
     * @param fromUserId
     * @return
     */
    @Query(value = "select toUserId from Relationship where fromUserId =:fromUserId",nativeQuery = true)
    List<Long> findByFromUserId(@Param("fromUserId") Long fromUserId);
}


